package com.stock.demo.adapter;

import android.content.Context;
import android.widget.TextView;

import com.stock.demo.R;
import com.stock.demo.adapter.viewholder.StockViewHolder;
import com.stock.demo.model.MarketHotBean;

import java.util.ArrayList;

/**
 * Created by XuZhaoyu on 2017/7/13.
 */

public class MarketViewBodyAdapter extends StockBaseAdapter<MarketHotBean> {

    private Context mContext;

    public MarketViewBodyAdapter(Context context, ArrayList<MarketHotBean> data) {
        super(context, data);
        mContext = context;
    }

    @Override
    public int setLayoutResId() {
        return R.layout.view_market_body_item;
    }

    @Override
    public void onBindViewHolder(StockViewHolder holder, int position) {
        TextView tvName = (TextView) holder.itemView.findViewById(R.id.tv_market_list_body_name);
        TextView tvChangePercent = (TextView) holder.itemView.findViewById(R.id.tv_market_list_body_change_percent);
        TextView tvTypicalCompany = (TextView) holder.itemView.findViewById(R.id.tv_market_list_body_typical_company);
        final MarketHotBean bean = getItem(position);
        if (bean != null) {
            tvName.setText(bean.mName);
            tvChangePercent.setText(bean.mChangePercent);
            tvTypicalCompany.setText(bean.mTypicalCompany);
        }
    }

}
